﻿<local:BaseWizardWindow
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:PSE.Deployment.SetupBase.UI;assembly=PSE.Deployment.SetupBase"    
	x:Class="Sinacor.Deployment.Setup.UI.PreRequisites"
	Title="Setup">
    <Window.Resources>
        <Style x:Key="ButtonTemplate" TargetType="{x:Type Button}">
            <Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <ContentPresenter />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

    <Grid>
        <Button HorizontalAlignment="Right" Style="{DynamicResource BotaoFechar}" VerticalAlignment="Top" Width="15" Height="15" Content="" Margin="0,15,15,0" x:Name="BtnClose"/>
        <TextBlock Margin="50,125,0,0" VerticalAlignment="Top" FontSize="12" TextWrapping="Wrap" HorizontalAlignment="Left" Width="860" Foreground="#FF333333"><Run FontSize="24" FontWeight="Bold" Foreground="#FF336699" Text="Pré-requisitos" Language="pt-br"/><LineBreak/><LineBreak/><Run Text="O instalador do SINACOR coletou os seguintes dados de seu sistema operacional." Language="pt-br"/><LineBreak/><Run Text="Por favor verifique através dos ícones e da legenda no rodapé da tela, o status dos componentes para prosseguir. Caso algum ítem seja impeditivo para a continuidade da instalação, " Language="pt-br"/><Run FontWeight="Bold" Text="posicione o mouse sobre o ícone indicador de status" Language="pt-br"/><Run Text=" para ler a mensagem detalhada e siga as instruções se for necessário." Language="pt-br"/><LineBreak/><Run Text="" Language="pt-br"/></TextBlock>
        <Button Margin="0,0,140,50" Style="{DynamicResource setupBt}" x:Name="BtnPrevious" Content="Retornar" Background="{DynamicResource BtBackColor}" VerticalAlignment="Bottom" Height="21" Foreground="#FFFFFFFF" HorizontalAlignment="Right" Width="80"/>
        <Button Margin="0,0,50,50" Style="{DynamicResource setupBt}" x:Name="BtnNext" Content="Avançar" Background="{DynamicResource BtBackColor}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="80" Height="21" Foreground="#FFFFFFFF"/>
        <WrapPanel HorizontalAlignment="Left" VerticalAlignment="Top" Width="860" Height="400" Margin="50,225,0,0" Orientation="Vertical">
            <ListView x:Name="lstSoftware" Style="{DynamicResource List}" Background="{DynamicResource BackCinza}" Width="860" Height="140" FontSize="12" FontWeight="Normal" IsSynchronizedWithCurrentItem="True" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HorizontalAlignment="Left" VerticalAlignment="Top" ItemsSource="{Binding Softwares, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" SelectionMode="Single">
                <ListView.View>
                    <GridView x:Name="GrdPrerequisites" ColumnHeaderContainerStyle="{DynamicResource ListaColunaCor}">
                        <GridViewColumn Header="Software" Width="375">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <Button x:Name="btnItem" Tag="{Binding}" Style="{StaticResource ButtonTemplate}" HorizontalAlignment="Left" Click="btnInformation_Click">
                                        <TextBlock x:Name="txtItem" Text="{Binding Item}" />
                                    </Button>
                                    <DataTemplate.Triggers>
                                        <DataTrigger Binding="{Binding HasLink}" Value="True">
                                            <Setter Property="TextDecorations" TargetName="txtItem" Value="Underline" />
                                            <Setter Property="Cursor" TargetName="btnItem" Value="Hand" />
                                            <Setter Property="ToolTip" TargetName="btnItem" Value="{Binding ToolTipMessage}" />
                                        </DataTrigger>
                                    </DataTemplate.Triggers>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>

                        <GridViewColumn Header="Recomendado" Width="375">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <Button x:Name="btnRecomended" Tag="{Binding}" Style="{StaticResource ButtonTemplate}" HorizontalAlignment="Left" Click="btnInformation_Click" >
                                        <TextBlock x:Name="txtRecomended" Text="{Binding Recomended}" />
                                    </Button>
                                    <DataTemplate.Triggers>
                                        <DataTrigger Binding="{Binding HasLink}" Value="True">
                                            <Setter Property="TextDecorations" TargetName="txtRecomended" Value="Underline" />
                                            <Setter Property="Cursor" TargetName="btnRecomended" Value="Hand" />
                                            <Setter Property="ToolTip" TargetName="btnRecomended" Value="{Binding ToolTipMessage}" />
                                        </DataTrigger>
                                    </DataTemplate.Triggers>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>

                        <GridViewColumn Header="Status" Width="95" x:Name="StatusIcon">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Tag="{Binding}" Style="{StaticResource ButtonTemplate}" Click="btnInformation_Click">
                                        <Image x:Name="StatusIcon" Source="{DynamicResource StatusError}" ToolTip="{Binding ToolTipMessage}" HorizontalAlignment="Center" VerticalAlignment="Top" Width="19" Height="19" />
                                    </Button>
                                    <DataTemplate.Triggers>
                                        <DataTrigger Binding="{Binding Status}" Value="Ok">
                                            <Setter Property="Source" TargetName="StatusIcon" Value="{DynamicResource StatusOK}" />
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding Status}" Value="NotOk">
                                            <Setter Property="Source" TargetName="StatusIcon" Value="{DynamicResource StatusError}" />
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding Status}" Value="Warning">
                                            <Setter Property="Source" TargetName="StatusIcon" Value="{DynamicResource StatusWarning}" />
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding HasLink}" Value="True">
                                            <Setter Property="Cursor" TargetName="StatusIcon" Value="Hand" />
                                        </DataTrigger>
                                    </DataTemplate.Triggers>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>
            <ListView Style="{DynamicResource List}" Background="{DynamicResource BackCinza}" Width="860" Height="100" FontSize="12" FontWeight="Normal" IsSynchronizedWithCurrentItem="True" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HorizontalAlignment="Left" VerticalAlignment="Top" ItemsSource="{Binding Permissions, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" SelectionMode="Single">
                <ListView.View>
                    <GridView x:Name="GrdPermission" ColumnHeaderContainerStyle="{DynamicResource ListaColunaCor}">
                        <GridViewColumn Header="Permissões" DisplayMemberBinding="{Binding Item}" Width="760"/>
                        <GridViewColumn Header="Status" Width="95">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <Image HorizontalAlignment="Center" Width="19" Source="{DynamicResource StatusError}" ToolTip="{Binding ToolTipMessage}" VerticalAlignment="Top" Height="19" x:Name="StatusIcon"/>
                                    <DataTemplate.Triggers>
                                        <DataTrigger Binding="{Binding Status}" Value="Ok">
                                            <Setter Property="Source" TargetName="StatusIcon" Value="{DynamicResource StatusOK}" />
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding Status}" Value="NotOk">
                                            <Setter Property="Source" TargetName="StatusIcon" Value="{DynamicResource StatusError}" />
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding Status}" Value="Warning">
                                            <Setter Property="Source" TargetName="StatusIcon" Value="{DynamicResource StatusWarning}" />
                                        </DataTrigger>
                                    </DataTemplate.Triggers>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>

            <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" Width="600">
                <Image HorizontalAlignment="Left" Margin="0,0,0,0" Width="19" Source="{DynamicResource StatusOK}" VerticalAlignment="Top" Height="19" x:Name="green"/>
                <TextBlock HorizontalAlignment="Left" Margin="30,0,0,0" VerticalAlignment="Top" TextWrapping="Wrap"><Run FontSize="12" Foreground="#FF333333" Text="OK" Language="pt-br"/></TextBlock>
                <Image HorizontalAlignment="Left" Margin="0,25,0,0" Width="19" Source="{DynamicResource StatusWarning}" Height="19" VerticalAlignment="Top" x:Name="yellow"/>
                <TextBlock HorizontalAlignment="Left" Margin="30,25,0,0" VerticalAlignment="Top" FontSize="12" Foreground="#FF333333" Text="Alerta: recomenda-se a leitura da mensagem disponibilizada pelo instalador" TextWrapping="Wrap"/>
                <Image HorizontalAlignment="Left" Margin="0,50,0,0" Width="19" Source="{DynamicResource StatusError}" VerticalAlignment="Top" Height="19" x:Name="red"/>
                <TextBlock HorizontalAlignment="Left" Margin="30,50,0,0" VerticalAlignment="Top" TextWrapping="Wrap" Text="Representa problemas para a instalação do SINACOR" FontSize="12" Foreground="#FF333333"/>
            </Grid>
        </WrapPanel>
    </Grid>
</local:BaseWizardWindow>